// 1.导入BrowserRouter Route
import React, { Component } from 'react';
//as  重命名为Router
import {
  BrowserRouter as Router,
  Route,
  Switch,
  Redirect,
} from 'react-router-dom';

import layout from './pages/Layout';
import login from './pages/Login';
export default class App extends Component {
  render() {
    //2.Router包住所有的代码
    return (
      <Router>
        {/* 3.配置路由规则和组件,使用Switch包住所有的Route */}
        <Switch>
          <Redirect from="/" to="/layout" exact></Redirect>
          <Route path="/layout" component={layout}></Route>
          <Route path="/login" component={login}></Route>
        </Switch>
      </Router>
    );
  }
}
